﻿using System;
using System.Data;
using System.Windows.Forms;
using System.Text;
using System.Data.SqlClient;

namespace DAL
{
    [Serializable]
    public class fdjData
    {

        public const string IDField = @"ID";

        public const string PRIMARYKEY_Field = @"ID";

        public const string GETTIMEField = @"GetTime";

        public const string ZSField = @"ZS";

        public const string JYYLField = @"JYYL";

        public const string RYYLField = @"RYYL";

        public const string LQSYLField = @"LQSYL";

        public const string LQSWDField = @"LQSWD";

        public const string RHYWDField = @"RHYWD";

        public const string PQWD1Field = @"PQWD1";

        public const string PQWD2Field = @"PQWD2";

        public const string PQWD3Field = @"PQWD3";

        public const string PQWD4Field = @"PQWD4";

        public const string PQWD5Field = @"PQWD5";

        public const string PQWD6Field = @"PQWD6";

        public const string UAField = @"Ua";

        public const string UBField = @"Ub";

        public const string UCField = @"Uc";

        public const string IAField = @"Ia";

        public const string IBField = @"Ib";

        public const string ICField = @"Ic";

        public const string FREQField = @"freq";

        public const string POWERField = @"Power";

        public const string ALLQField = @"allQ";

        private Int32 _ID;

        private DateTime _GetTime;

        private Double _ZS;

        private Double _JYYL;

        private Double _RYYL;

        private Double _LQSYL;

        private Double _LQSWD;

        private Double _RHYWD;

        private Double _PQWD1;

        private Double _PQWD2;

        private Double _PQWD3;

        private Double _PQWD4;

        private Double _PQWD5;

        private Double _PQWD6;

        private Double _Ua;

        private Double _Ub;

        private Double _Uc;

        private Double _Ia;

        private Double _Ib;

        private Double _Ic;

        private Double _freq;

        private Double _Power;

        private Double _allQ;

        public Int32 ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        public DateTime GetTime
        {
            get { return _GetTime; }
            set { _GetTime = value; }
        }
        public Double ZS
        {
            get { return _ZS; }
            set { _ZS = value; }
        }
        public Double JYYL
        {
            get { return _JYYL; }
            set { _JYYL = value; }
        }
        public Double RYYL
        {
            get { return _RYYL; }
            set { _RYYL = value; }
        }
        public Double LQSYL
        {
            get { return _LQSYL; }
            set { _LQSYL = value; }
        }
        public Double LQSWD
        {
            get { return _LQSWD; }
            set { _LQSWD = value; }
        }
        public Double RHYWD
        {
            get { return _RHYWD; }
            set { _RHYWD = value; }
        }
        public Double PQWD1
        {
            get { return _PQWD1; }
            set { _PQWD1 = value; }
        }
        public Double PQWD2
        {
            get { return _PQWD2; }
            set { _PQWD2 = value; }
        }
        public Double PQWD3
        {
            get { return _PQWD3; }
            set { _PQWD3 = value; }
        }
        public Double PQWD4
        {
            get { return _PQWD4; }
            set { _PQWD4 = value; }
        }
        public Double PQWD5
        {
            get { return _PQWD5; }
            set { _PQWD5 = value; }
        }
        public Double PQWD6
        {
            get { return _PQWD6; }
            set { _PQWD6 = value; }
        }
        public Double Ua
        {
            get { return _Ua; }
            set { _Ua = value; }
        }
        public Double Ub
        {
            get { return _Ub; }
            set { _Ub = value; }
        }
        public Double Uc
        {
            get { return _Uc; }
            set { _Uc = value; }
        }
        public Double Ia
        {
            get { return _Ia; }
            set { _Ia = value; }
        }
        public Double Ib
        {
            get { return _Ib; }
            set { _Ib = value; }
        }
        public Double Ic
        {
            get { return _Ic; }
            set { _Ic = value; }
        }
        public Double freq
        {
            get { return _freq; }
            set { _freq = value; }
        }
        public Double Power
        {
            get { return _Power; }
            set { _Power = value; }
        }
        public Double allQ
        {
            get { return _allQ; }
            set { _allQ = value; }
        }
        public fdjData()
        {
            _ID = 0;
            _GetTime = DateTime.Now;
            _ZS = 0;
            _JYYL = 0;
            _RYYL = 0;
            _LQSYL = 0;
            _LQSWD = 0;
            _RHYWD = 0;
            _PQWD1 = 0;
            _PQWD2 = 0;
            _PQWD3 = 0;
            _PQWD4 = 0;
            _PQWD5 = 0;
            _PQWD6 = 0;
            _Ua = 0;
            _Ub = 0;
            _Uc = 0;
            _Ia = 0;
            _Ib = 0;
            _Ic = 0;
            _freq = 0;
            _Power = 0;
            _allQ = 0;
        }
    }

    public class fdj1AlarmDataFactory
    {
        public static fdjData Construct(IDataReader reader)
        {
            fdjData data = new fdjData();

            try { data.ID = Convert.ToInt32(reader["ID"]); }
            catch { }

            try { data.GetTime = Convert.ToDateTime(reader["GetTime"]); }
            catch { }

            try { data.ZS = Convert.ToDouble(reader["ZS"]); }
            catch { }

            try { data.JYYL = Convert.ToDouble(reader["JYYL"]); }
            catch { }

            try { data.RYYL = Convert.ToDouble(reader["RYYL"]); }
            catch { }

            try { data.LQSYL = Convert.ToDouble(reader["LQSYL"]); }
            catch { }

            try { data.LQSWD = Convert.ToDouble(reader["LQSWD"]); }
            catch { }

            try { data.RHYWD = Convert.ToDouble(reader["RHYWD"]); }
            catch { }

            try { data.PQWD1 = Convert.ToDouble(reader["PQWD1"]); }
            catch { }

            try { data.PQWD2 = Convert.ToDouble(reader["PQWD2"]); }
            catch { }

            try { data.PQWD3 = Convert.ToDouble(reader["PQWD3"]); }
            catch { }

            try { data.PQWD4 = Convert.ToDouble(reader["PQWD4"]); }
            catch { }

            try { data.PQWD5 = Convert.ToDouble(reader["PQWD5"]); }
            catch { }

            try { data.PQWD6 = Convert.ToDouble(reader["PQWD6"]); }
            catch { }

            try { data.Ua = Convert.ToDouble(reader["Ua"]); }
            catch { }

            try { data.Ub = Convert.ToDouble(reader["Ub"]); }
            catch { }

            try { data.Uc = Convert.ToDouble(reader["Uc"]); }
            catch { }

            try { data.Ia = Convert.ToDouble(reader["Ia"]); }
            catch { }

            try { data.Ib = Convert.ToDouble(reader["Ib"]); }
            catch { }

            try { data.Ic = Convert.ToDouble(reader["Ic"]); }
            catch { }

            try { data.freq = Convert.ToDouble(reader["freq"]); }
            catch { }

            try { data.Power = Convert.ToDouble(reader["Power"]); }
            catch { }

            try { data.allQ = Convert.ToDouble(reader["allQ"]); }
            catch { }

            return data;
        }
        public static Int32 GetPrimaryKey(DataTable dt)
        {
            return GetPrimaryKey(dt, 0);
        }
        public static Int32 GetPrimaryKey(DataTable dt, int rowIndex)
        {
            Int32 PrimaryKey = 0;

            if (dt.Rows.Count < rowIndex + 1)

                return 0;

            DataRow dr = dt.Rows[rowIndex];

            if (dr == null)

                return 0;

            try { PrimaryKey = Convert.ToInt32(dr[fdjData.PRIMARYKEY_Field]); }
            catch { }

            return PrimaryKey;
        }
        public static fdjData Construct(DataTable dt)
        {
            return Construct(dt, 0);
        }
        public static fdjData Construct(DataTable dt, int rowIndex)
        {
            fdjData data = new fdjData();

            if (dt.Rows.Count < rowIndex + 1)

                return null;

            DataRow dr = dt.Rows[rowIndex];

            if (dr == null)

                return null;

            try { data.ID = Convert.ToInt32(dr["ID"]); }
            catch { }

            try { data.GetTime = Convert.ToDateTime(dr["GetTime"]); }
            catch { }

            try { data.ZS = Convert.ToDouble(dr["ZS"]); }
            catch { }

            try { data.JYYL = Convert.ToDouble(dr["JYYL"]); }
            catch { }

            try { data.RYYL = Convert.ToDouble(dr["RYYL"]); }
            catch { }

            try { data.LQSYL = Convert.ToDouble(dr["LQSYL"]); }
            catch { }

            try { data.LQSWD = Convert.ToDouble(dr["LQSWD"]); }
            catch { }

            try { data.RHYWD = Convert.ToDouble(dr["RHYWD"]); }
            catch { }

            try { data.PQWD1 = Convert.ToDouble(dr["PQWD1"]); }
            catch { }

            try { data.PQWD2 = Convert.ToDouble(dr["PQWD2"]); }
            catch { }

            try { data.PQWD3 = Convert.ToDouble(dr["PQWD3"]); }
            catch { }

            try { data.PQWD4 = Convert.ToDouble(dr["PQWD4"]); }
            catch { }

            try { data.PQWD5 = Convert.ToDouble(dr["PQWD5"]); }
            catch { }

            try { data.PQWD6 = Convert.ToDouble(dr["PQWD6"]); }
            catch { }

            try { data.Ua = Convert.ToDouble(dr["Ua"]); }
            catch { }

            try { data.Ub = Convert.ToDouble(dr["Ub"]); }
            catch { }

            try { data.Uc = Convert.ToDouble(dr["Uc"]); }
            catch { }

            try { data.Ia = Convert.ToDouble(dr["Ia"]); }
            catch { }

            try { data.Ib = Convert.ToDouble(dr["Ib"]); }
            catch { }

            try { data.Ic = Convert.ToDouble(dr["Ic"]); }
            catch { }

            try { data.freq = Convert.ToDouble(dr["freq"]); }
            catch { }

            try { data.Power = Convert.ToDouble(dr["Power"]); }
            catch { }

            try { data.allQ = Convert.ToDouble(dr["allQ"]); }
            catch { }

            return data;
        }
        public static fdjData Construct(DataGridView dgv, int rowIndex)
        {
            fdjData data = new fdjData();

            if (dgv.Rows.Count < rowIndex + 1)

                return null;

            DataGridViewCellCollection dr = dgv.Rows[rowIndex].Cells;

            if (dr == null)

                return null;

            try { data.ID = Convert.ToInt32(dr["ID"]); }
            catch { }

            try { data.GetTime = Convert.ToDateTime(dr["GetTime"]); }
            catch { }

            try { data.ZS = Convert.ToDouble(dr["ZS"]); }
            catch { }

            try { data.JYYL = Convert.ToDouble(dr["JYYL"]); }
            catch { }

            try { data.RYYL = Convert.ToDouble(dr["RYYL"]); }
            catch { }

            try { data.LQSYL = Convert.ToDouble(dr["LQSYL"]); }
            catch { }

            try { data.LQSWD = Convert.ToDouble(dr["LQSWD"]); }
            catch { }

            try { data.RHYWD = Convert.ToDouble(dr["RHYWD"]); }
            catch { }

            try { data.PQWD1 = Convert.ToDouble(dr["PQWD1"]); }
            catch { }

            try { data.PQWD2 = Convert.ToDouble(dr["PQWD2"]); }
            catch { }

            try { data.PQWD3 = Convert.ToDouble(dr["PQWD3"]); }
            catch { }

            try { data.PQWD4 = Convert.ToDouble(dr["PQWD4"]); }
            catch { }

            try { data.PQWD5 = Convert.ToDouble(dr["PQWD5"]); }
            catch { }

            try { data.PQWD6 = Convert.ToDouble(dr["PQWD6"]); }
            catch { }

            try { data.Ua = Convert.ToDouble(dr["Ua"]); }
            catch { }

            try { data.Ub = Convert.ToDouble(dr["Ub"]); }
            catch { }

            try { data.Uc = Convert.ToDouble(dr["Uc"]); }
            catch { }

            try { data.Ia = Convert.ToDouble(dr["Ia"]); }
            catch { }

            try { data.Ib = Convert.ToDouble(dr["Ib"]); }
            catch { }

            try { data.Ic = Convert.ToDouble(dr["Ic"]); }
            catch { }

            try { data.freq = Convert.ToDouble(dr["freq"]); }
            catch { }

            try { data.Power = Convert.ToDouble(dr["Power"]); }
            catch { }

            try { data.allQ = Convert.ToDouble(dr["allQ"]); }
            catch { }

            return data;
        }
        public static Int32 GetPrimaryKey(DataGridView dgv, int rowIndex)
        {
            Int32 PrimaryKey = 0;

            if (dgv.Rows.Count < rowIndex + 1)

                return 0;

            DataGridViewCellCollection dr = dgv.Rows[rowIndex].Cells;

            if (dr == null)

                return 0;

            for (int i = 0; i < dgv.Columns.Count; i++)
            {
                if (dgv.Columns[i].DataPropertyName == fdjData.PRIMARYKEY_Field)
                {
                    try { PrimaryKey = Convert.ToInt32(dr[i].Value); }
                    catch { }
                    return PrimaryKey;
                }
            }
            return PrimaryKey;
        }
        public static fdjData Construct(DataRow dr)
        {
            fdjData data = new fdjData();

            try { data.ID = Convert.ToInt32(dr["ID"]); }
            catch { }

            try { data.GetTime = Convert.ToDateTime(dr["GetTime"]); }
            catch { }

            try { data.ZS = Convert.ToDouble(dr["ZS"]); }
            catch { }

            try { data.JYYL = Convert.ToDouble(dr["JYYL"]); }
            catch { }

            try { data.RYYL = Convert.ToDouble(dr["RYYL"]); }
            catch { }

            try { data.LQSYL = Convert.ToDouble(dr["LQSYL"]); }
            catch { }

            try { data.LQSWD = Convert.ToDouble(dr["LQSWD"]); }
            catch { }

            try { data.RHYWD = Convert.ToDouble(dr["RHYWD"]); }
            catch { }

            try { data.PQWD1 = Convert.ToDouble(dr["PQWD1"]); }
            catch { }

            try { data.PQWD2 = Convert.ToDouble(dr["PQWD2"]); }
            catch { }

            try { data.PQWD3 = Convert.ToDouble(dr["PQWD3"]); }
            catch { }

            try { data.PQWD4 = Convert.ToDouble(dr["PQWD4"]); }
            catch { }

            try { data.PQWD5 = Convert.ToDouble(dr["PQWD5"]); }
            catch { }

            try { data.PQWD6 = Convert.ToDouble(dr["PQWD6"]); }
            catch { }

            try { data.Ua = Convert.ToDouble(dr["Ua"]); }
            catch { }

            try { data.Ub = Convert.ToDouble(dr["Ub"]); }
            catch { }

            try { data.Uc = Convert.ToDouble(dr["Uc"]); }
            catch { }

            try { data.Ia = Convert.ToDouble(dr["Ia"]); }
            catch { }

            try { data.Ib = Convert.ToDouble(dr["Ib"]); }
            catch { }

            try { data.Ic = Convert.ToDouble(dr["Ic"]); }
            catch { }

            try { data.freq = Convert.ToDouble(dr["freq"]); }
            catch { }

            try { data.Power = Convert.ToDouble(dr["Power"]); }
            catch { }

            try { data.allQ = Convert.ToDouble(dr["allQ"]); }
            catch { }

            return data;
        }
        public static Int32 GetPrimaryKey(DataRow dr)
        {
            Int32 PrimaryKey = 0;

            try { PrimaryKey = Convert.ToInt32(dr[fdjData.PRIMARYKEY_Field]); }
            catch { }
            return PrimaryKey;
        }

    }
    public class fdjDataDBOption
    {
        public static int Insert(fdjData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("insert into fdj1Alarm (");
            sql.Append("GetTime, ");
            sql.Append("ZS, ");
            sql.Append("JYYL, ");
            sql.Append("RYYL, ");
            sql.Append("LQSYL, ");
            sql.Append("LQSWD, ");
            sql.Append("RHYWD, ");
            sql.Append("PQWD1, ");
            sql.Append("PQWD2, ");
            sql.Append("PQWD3, ");
            sql.Append("PQWD4, ");
            sql.Append("PQWD5, ");
            sql.Append("PQWD6, ");
            sql.Append("Ua, ");
            sql.Append("Ub, ");
            sql.Append("Uc, ");
            sql.Append("Ia, ");
            sql.Append("Ib, ");
            sql.Append("Ic, ");
            sql.Append("freq, ");
            sql.Append("Power, ");
            sql.Append("allQ");
            sql.Append(") values (");
            sql.Append("'");
            sql.Append(d.GetTime.ToString("yyyy-MM-dd HH:mm:ss"));
            sql.Append("'");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.ZS.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.JYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.RYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.LQSYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.LQSWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.RHYWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD1.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD2.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD3.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD4.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD5.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD6.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ua.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ub.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Uc.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ia.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ib.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ic.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.freq.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Power.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.allQ.ToString());
            sql.Append("");
            sql.Append(")");
            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static int Update(fdjData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("update fdj1Alarm set ");
            sql.Append("GetTime=");
            sql.Append("'");
            sql.Append(d.GetTime.ToString("yyyy-MM-dd HH:mm:ss"));
            sql.Append("'");
            sql.Append(", ");
            sql.Append("ZS=");
            sql.Append("");
            sql.Append(d.ZS.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("JYYL=");
            sql.Append("");
            sql.Append(d.JYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("RYYL=");
            sql.Append("");
            sql.Append(d.RYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("LQSYL=");
            sql.Append("");
            sql.Append(d.LQSYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("LQSWD=");
            sql.Append("");
            sql.Append(d.LQSWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("RHYWD=");
            sql.Append("");
            sql.Append(d.RHYWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD1=");
            sql.Append("");
            sql.Append(d.PQWD1.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD2=");
            sql.Append("");
            sql.Append(d.PQWD2.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD3=");
            sql.Append("");
            sql.Append(d.PQWD3.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD4=");
            sql.Append("");
            sql.Append(d.PQWD4.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD5=");
            sql.Append("");
            sql.Append(d.PQWD5.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("PQWD6=");
            sql.Append("");
            sql.Append(d.PQWD6.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Ua=");
            sql.Append("");
            sql.Append(d.Ua.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Ub=");
            sql.Append("");
            sql.Append(d.Ub.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Uc=");
            sql.Append("");
            sql.Append(d.Uc.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Ia=");
            sql.Append("");
            sql.Append(d.Ia.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Ib=");
            sql.Append("");
            sql.Append(d.Ib.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Ic=");
            sql.Append("");
            sql.Append(d.Ic.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("freq=");
            sql.Append("");
            sql.Append(d.freq.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("Power=");
            sql.Append("");
            sql.Append(d.Power.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("allQ=");
            sql.Append("");
            sql.Append(d.allQ.ToString());
            sql.Append("");
            sql.Append(" where ID=");
            sql.Append("");
            sql.Append(d.ID.ToString()); sql.Append("");

            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static int Delete(fdjData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from fdj1Alarm ");
            sql.Append(" where ID=");
            sql.Append("");
            sql.Append(d.ID.ToString());
            sql.Append("");
            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static DataTable DataTableSelect()
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from fdj1Alarm ");
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
        public static DataTable DataTableSelect(fdjData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from fdj1Alarm where ID=");
            sql.Append("");
            sql.Append(d.ID.ToString());
            sql.Append("");
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
        public static fdjData Get(Int32 _id)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from fdj1Alarm where ID=");
            sql.Append("");
            sql.Append(_id.ToString());
            sql.Append("");
            DataTable dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
            if (dt.Rows.Count == 0)
                return null;
            else
                return fdj1AlarmDataFactory.Construct(dt.Rows[0]);
        }
        public static DataSet DataSetSelect()
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from fdj1Alarm ");
            return WFNetLib.ADO.SQLServerOP.DataSetSQL(sql.ToString());
        }
        public static SqlDataReader ReaderSelect(fdjData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from fdj1Alarm ");
            return WFNetLib.ADO.SQLServerOP.ReaderExecuteSQL(sql.ToString());
        }
        public static int Insert(fdjData d,string tableName)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("insert into "+tableName+" (");
            sql.Append("GetTime, ");
            sql.Append("ZS, ");
            sql.Append("JYYL, ");
            sql.Append("RYYL, ");
            sql.Append("LQSYL, ");
            sql.Append("LQSWD, ");
            sql.Append("RHYWD, ");
            sql.Append("PQWD1, ");
            sql.Append("PQWD2, ");
            sql.Append("PQWD3, ");
            sql.Append("PQWD4, ");
            sql.Append("PQWD5, ");
            sql.Append("PQWD6, ");
            sql.Append("Ua, ");
            sql.Append("Ub, ");
            sql.Append("Uc, ");
            sql.Append("Ia, ");
            sql.Append("Ib, ");
            sql.Append("Ic, ");
            sql.Append("freq, ");
            sql.Append("Power, ");
            sql.Append("allQ");
            sql.Append(") values (");
            sql.Append("'");
            sql.Append(d.GetTime.ToString("yyyy-MM-dd HH:mm:ss"));
            sql.Append("'");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.ZS.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.JYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.RYYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.LQSYL.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.LQSWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.RHYWD.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD1.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD2.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD3.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD4.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD5.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PQWD6.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ua.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ub.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Uc.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ia.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ib.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Ic.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.freq.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.Power.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.allQ.ToString());
            sql.Append("");
            sql.Append(")");
            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static DataTable DataTableSelect(string tableName,DateTime t1,DateTime t2)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from " + tableName + " where GetTime  BETWEEN '");
            sql.Append(t1.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '");
            sql.Append(t2.ToString("yyyy-MM-dd HH:mm:ss") + "' order by GetTime desc");
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
    }
}